home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
MORSE_CD
/
SHOWINIT.C
< prev
Wrap
Text File
|
1989-11-11
|
2KB
|
87 lines
/*
Simple INIT notification routine in THINK C 3.02
*/
#define CKSM(i) \
asm { \
ROL #1,i \
EOR #0x1021,i \
}
typedef struct QuickDraw { /* QuickDraw globals */
char private[76];
long randSeed;
BitMap screenBits;
Cursor arrow;
Pattern dkGray;
Pattern ltGray;
Pattern gray;
Pattern black;
Pattern white;
GrafPtr thePort;
} QuickDraw;
extern short myH : 0x92C; /* CurApName + 28 */
extern short myCheck: 0x92E; /* CurApName + 30 */
extern long oldSig: 0xA78; /* ApplScratch */
extern short oldH: 0xA7E; /* ApplScratch + 6 */
void ShowINIT(iconID)
register short iconID; /* ICN# resource ID */
{
register Handle h;
register short i;
Rect srcRect, destRect;
BitMap myBitMap;
GrafPort myPort;
struct {
QuickDraw qdGlobals;
Ptr localA5;
} qd;
asm {
MOVE.L A5,-(SP)
LEA.L qd.localA5,A5
}
if (!(h = GetResource('ICN#', iconID)))
goto out; /* Error */
InitGraf(&qd.qdGlobals.thePort);
OpenPort(&myPort);
i = myH;
CKSM(i);
if (i == myCheck)
i = myH;
else
if (oldSig == 'Paul')
i = oldH;
else
i = 8;
destRect.bottom = myPort.portRect.bottom - 8;
destRect.left = myPort.portRect.left + i;
destRect.top = destRect.bottom - 32;
destRect.right = destRect.left + 32;
i += 40;
myH = i;
CKSM(i);
myCheck = i;
HLock(h);
srcRect.top = srcRect.left = 0;
srcRect.bottom = srcRect.right = 32;
myBitMap.rowBytes = 4;
myBitMap.bounds = srcRect;
myBitMap.baseAddr = *h + 128; /* Skip to mask */
CopyBits(&myBitMap, &myPort.portBits, &srcRect, &destRect, srcBic, 0L);
myBitMap.baseAddr = *h; /* Now draw icon */
CopyBits(&myBitMap, &myPort.portBits, &srcRect, &destRect, srcOr, 0L);
HUnlock(h);
ReleaseResource(h);
ClosePort(&myPort);
out:
asm {
MOVE.L (SP)+,A5
}
}